NG Tree Builder
This document explains some features of new NG Tree Builder you find in Animation Editor, supported by trng_fixer.dll (v. 1.1.0.0 or higher)
Other the description of NTB (Ng Tree Builder) interface, there will be also a tutorial about how change mesh joints to modify existing moveable or creating from scratch a new moveable.
Summary
NG Tree Builder Interface
"Mesh Joints" frame
"Delete" button
"Clear All" button
"Sort" button
"Report" (Mesh Joints) button
"Load" button
"Save ..." button
"Save" button
"New Parent" button
"Replace Parent" button
"Child" button
"Frame Adjustment" button
"Restore" button
"Meshes" frame
"Load Names" button
"Save Names" button
"Report" (Mesh) button
"Mesh Now" frame
"Mesh Name" text box
"Rename" button
"Edit Mesh" button
Edit Mesh Window
"Mesh Center" frame
"Recompute Center and Radius" button
"Multiply by" (single mesh) button
"3d Tools" frame
"Move Mesh" button
"Rotate Mesh" button
Direction of Rotation in Animation Editor's axis reference
"Semi-transparent mesh" option
"Set as invisible" button
"Restore visibility" button
"Copy" and "Export" buttons
"Paste" and "Import" buttons
"Transpositions" frame
Understanding Transposition values
Another way to modify Transposition Values
Some execptions about axis rule
"Update" button
"Scale factor" frame and "Multiply by" button
Some experiment of resizing moveables
Little skeleton
Giant Skeleton
"Load Transposition" button
"Save Transpositions" button
"Compute Transpositions" button
Transposition Analyser window
"Basic Joint Posture mesh" text box
"Compute Transposition values" button
"Get meshes different, if it will be found a duplicated" option
"Check for duplicated meshes" button
"Reset of animation data" frame
"Clear all animations (except one)" button
"Use mesh names also in Animation Editor" option
How to move, scale or rotate vertices of a Mesh in Animation Editor
Moving vertices of a mesh
Scaling (to change size) of a mesh
Turning vertices of a mesh
Different kinds of mods on Moveable Mesh Tree
Little adjustments on mesh joints
Moving joints in substantial way
Modifying the jeep in a monster car
Removing joints and/or meshes from a movable
Transforming a scorpion into a Spider
How to replace a mesh
Importing old mesh in MetaSequoia
Modelling a Black Widow's body
Creating a new moveable from scratch
Projecting a really new moveable
Our Anaconda: choosing the root mesh
Some suggstions about mesh-modelling with Metasequoia
Loading in the scene also a copy of Lara
Meshes should be pasted and partially incorporated
How to duplicate meshes
Using only 90/180 degree rotations
The set of meshes for our Anaconda
Preparing the slot for our Anaconda
Adding a mesh to a moveable
Saving all single meshes
Setting the correct origin for each mesh
Using parent mesh as reference for child mesh
Keeping always child's origin toward its parent mesh
Importing all meshes in the wad
Assigning names to Anaconda's meshes
Verify for duplicated meshes
Set all meshes as unique
Building our Basic Joint Posture in Metasquoia
Aligning all mehses in our final Basic Joint posture
The "always orthogonal" rule
Our final Basic Joint Posture
Importing the basic joint posture with StrPix
Creating the parent-child pairs
Update the Anaconda's mesh tree
Warning for wrong number of vertices
We got our final mesh tree
Resetting old animation data
Fixing some meshes
Adding textures to Anaconda
How to modify the pivot of rotation
Trick: how to move a sub-mesh of a moveable
Our Armored sliding Door
Our target: to move two sliding Bars' sets
Choosing the axis where to move pivot
Animation of our sliding door
Trying in game the sliding door
Conclusions
NG Tree Builder Interface
"Mesh Joints" frame
In mesh joints frame there is the list of paired mesh, linked between them by a connection "parent / child".
When you add/modify these couple you have not to worry about their sorting, the sorting will be performed by NTB when you click on [OK] button or, if you wish see that in advance, clicking on [Sort] button.
"Delete" button
Remove from Mesh joints list the selected couple.
"Clear All" button
Remove all couples from the Mesh Joints list
"Sort" button
Put the Mesh Joints pairs in right order, how they should appear in mesh tree data.
Note: this button is also a way to verify if you placed all meshes correctly, indeed, if there is some missing mesh, you'll be warned about this error.
"Report" (Mesh Joints) button
It will show a text file with current Mesh Joints list.
An output like this:
MESH JOINTS FOR SLOT 0
Parent Child
-------------------------------------------------
0: Butt 1: Thigh (left)
1: Thigh (left) 2: Calf (left)
2: Calf (left) 3: Foot (left)
0: Butt 4: Thigh (right)
4: Thigh (right) 5: Calf (right)
5: Calf (right) 6: Foot (right)
0: Butt 7: Chest
7: Chest 8: Arm (right)
8: Arm (right) 9: Forearm (right)
9: Forearm (right) 10: Hand (right)
7: Chest 11: Arm (left)
11: Arm (left) 12: Forearm (left)
12: Forearm (left) 13: Hand (left)
7: Chest 14: Head
-------------------------------------------------
"Load" button
With this command you can loading a ".tree" file that will contain all data loaded in NTB window.
Since building a new movebale could be a long operation, it is advisable save your work until you are not ready to set in the wad all data. About this speech, remember that, until you don't click on [Ok] button. no change will happen in current wad file.
Note: above rule has an expection only with [Multiply] button, if you accept to change (physically) the meshes. Anyway you will be warned about this situation.
"Save ..." button
Save current tree data (loaded in NTB window) in a .tree file whose you should assign a name.
Note: for technical limitaiton, you'll have not the chance to choose also the folder where to save the .tree file. All .tree files will be saved the subfolder "Tree_Projects" of Wad Merger folder.
"Save" button
Save current tree data in current tree file.
It works (without promiting you for the name) only if current tree data had been previously loaded by some .tree file.
Note: if you had not loaded current data from a .tree file, the [Save] button will work as [Save...] button, asking you for a file name.
"New Parent" button
It copies a mesh, from "Meshes" of right list box , to "Mesh Joints" of left list, placing it in "Parent" column. Using this command the mesh will be always placed at end of "Mesh Joints" list, adding a new item.
"Replace Parent" button
This button works in similar way of above "New Parent" but in this case the mesh will be place over selected Mesh Joint item, replacing a further previous value in Parent column.
"Child" button
It copies selected mesh, from "Meshes" left list to "Mesh Joints" right list, in "Child" column. It will replace the further "Child" value in selected item of "Mesh Joints" list.
"Frame Adjustment" button
The frame adjustement is about the absolute position of root mesh of moveable. Each frame has a translation structure for root mesh (mesh 0).
Modifying this structure will affect the position for all other meshes, since they follow always their parent (the root mesh).
The frame adjustment will be used overall to move up/down the moveable when you see that it's not well aligned with floor surface. This misalignment could happen after you changed the scal factor of some mesh or when you changed some joint positions (translation values) of the moveable.
When you engage this command, you'll be prompeted for the signed value to add and about on what axis coordinate to work. To change the up/down position you should choose always "Y" axis. To move upward the moveable you should choose a negative value, while to move down the object, you'll choose a positive value.
At end the program will ask if you want that also the collsion boxes (for each frame) were updated. Usually you'll reply "yes", of course.
"Restore" button
It will restore all tree data (mesh joints pairs and transposition values for each mesh) that had been taken from wad file when you launched NG Tree Builder. This is a way to "undo" all changes you made and to have newly origiginal data of current object.
Note that, if you perform following operations:
- Start Animation Editor with some moveable
- Click on [NG Tree Builder" button
Now NTB will perform the copy of original tree data that you'll be able to restore with "Restore" button.
Anyway, if you don't save to a .tree file your work, when you get off by NTB window and then (later) launch newly NTB, the copy of original data, will be alway that of last time you clicked on [NG Tree Button], so it could be not the real original tree data but that you had change in your last job session using NTB.
To avoid this problem, you should rememebr to save always a .tree file, after you performed some change on tree data, because, when you save a .tree file, inside this file, there will be also the original tree data from wad file. In this way you could restore original data, also afer a lot of time and many job sessions, simply loading the ".tree" file you had saved first time and then restored clicking on "Restore" button.
"Meshes" frame
In "Meshes" frame you can see data about all meshes of current object and their names, if you loaded a ".nmf" file or you reassigned a name for each mesh.
You'll have to use the "Meshes" list box for two reasons: copy a mesh in "Mesh Joints" list, as Parent or Child, or to change the transposition values for each mesh.
"Load Names" button
This button permits to load a new set of names for meshes. The files with mesh names have a ".NMF" (Name Mesh File) extension and, by default, they will be saved in "MeshNameFiles" subfolder of current Wad Merger folder.
Note that, in spite of ".nmf" extensione these are common text files, so you could edit or read their content also opening them with block notes. Just you click on one of these files and select, with right mouse button, the item "Open with..." choosing notepad, blocknotes or other text editors.
This is internal format of a .nmf file:
SLOT:0-16
0: Butt
1: Thigh (left)
2: Calf (left)
3: Foot (left)
4: Thigh (right)
5: Calf (right)
6: Foot (right)
7: Chest
8: Arm (right)
9: Forearm (right)
10: Hand (right)
11: Arm (left)
12: Forearm (left)
13: Hand (left)
14: Head
As you can see, the colon ":" character works as separator between mesh index and its name.
In first line there will be the info about slot that uses these names for its meshes.
Above example was for Lara that is, currently, only one objec to have many slots (from 0 to 16) using (almost) same meshes. For ohter moveable the syntax of first line will be:
SLOT:39
With only a number after colon character. ( Above is the line for "Von Croy" object.)
Thanks to slot line, NTB will be able to locate itself the .nmf file for the object you just loaded in NTB window, parsing all files stored in "MeshNameFiles" subfolder.
"Save Names" button
It save to a ".nmf" file, the names associated with current mesh list. If you want label with names the meshes of some moveable (using the "Rename" button), at end you should remember to save these names with "Save Names" button.
"Report" (Mesh) button
It create a report about current meshes, their names and Transpositions, like this:
MESHES OF SLOT 35
## NAME X Y Z
--------------------------------------------------
0: Butt 0 0 0
1: Thigh (left) 47 18 12
2: Calf (left) 23 215 8
3: Foot (left) 7 204 1
4: Thigh (right) -50 15 18
5: Calf (right) -29 212 -1
6: Foot (right) 10 201 3
7: Backbone 1 -53 9
8: Chest 2 -52 2
9: Head -2 -195 -30
10: Arm (left) -85 -114 -39
11: Forearm (left) -16 134 0
12: Arm (right) 77 -112 -39
13: Forearm (right) 19 133 0
14: Hand Sword (right) 9 147 -8
15: Hand alternate (right) 0 25 0
16: Hand alternate 2 (right) 0 0 0
--------------------------------------------------
"Mesh Now" frame
In this frame you'll have the chance to change some feature of currently selected mesh in "Meshes" listbox.
"Mesh Name" text box
You can read here the name of currently selected mesh. You can also change its name and then update that with [Rename] button (see below)
"Rename" button
If you change the name of current mesh you can update it clicking on this button.
Note: remember to save current meshes' name with [Save Names] button, at end of your job, otherwise you'll lose all changes of names.
"Edit Mesh" button
It will show following window
Edit Mesh Window
"Mesh Center" frame
You can change center of current mesh (x, y and z), Radius and collision flag.
Note: to be honest, in multimesh moveables, there will be no big change in the mesh, after editing only center, radius or collision. If you want move the relative position of current mesh, you should modify its trasposition offsets and then click on [Update] button in NTB's main window, or using the [Move Mesh] button in "3d Tools" frame.
Anyway the center of the mesh will be used with 3d Tool [Rotate Mesh].
"Recompute Center and Radius" button
Please, don't confuse this button as a way to validate the center values you typed in above input boxes: it doesn't work in this way. To valide the typed values, you should use the [Ok] button of "Edit Mesh" window.
The "Recompute Center and Radius" button will set new center's values, computing the position of mesh's vertices. This operation could be advisable if you created this mesh using Metasequoia and then imported it as .dxf, in StrPix program. In above case, indeed, the center's values will be the old values of previous original mesh, and probably they will be not coherent with new mesh shape.
"Multiply by" (single mesh) button
You can change scale factor of current mesh, modifing its size in proportional way on some (or all) axis.
The factor should be in floating point format, where [1.0] means: no change, [3.0] will magnify the mesh of 300 %, and [0.1] will reduce the size of the mesh of 10 times.
The [Multiply by] button works like that in main NG Tree Builder window but, in this case, it will work only on the single mesh loaded in "Edit Mesh" window and it will not affect the transposition values of current mesh.
Notes:
1) The change about scale factor will happen immediately when you click on [Multiply by] button and not with [Ok] button of Edit Mesh's window.
2) I remind you that there is a command to scale a mesh also in Animation Editor (menu command: "Meshes/Scale Mesh" and now you can use also drag icons to modify the size in real time.
"3d Tools" frame
In this frame there are different 3d tools but each of them, will use as input the three input box for axis X,Y and Z.
The values to type will change in according with the kind of command, of course
Note: the 3d operations that you can perform in this window are also available in Animation Editor window but using the drag icons. See How to move, scale or rotate vertices of a Mesh in Animation Editor chapter.
"Move Mesh" button
With this command you can move current mesh in 3d space.
In above picture you see the Lara's head in its original position (A picture) with the origin (0,0,0) almost in the middle of mesh. In right (B) picture you can see what happens if you type -100 in X axis input box. The mesh is like had been moved in that direction and, indeed, then, in game or in Animation editor, you should see own that different position.
Note: in above picture I used the Animation Editor reference for axis dirction, where -X is at right, in spite above picture has been take from Metasequoia, where the X axis has an inverted direction respect Animation editor.
Now we should wonder: why should we use this method to move the mesh's position, when we could get same target changing the X (in above case) transposition value in tree builder? The reason is that, the two changes, don't get same final situation, because the center of rotation (the yellow point in B picture) will be always in (0,0.0) origin also after the mesh movement, while, changing the transposition value (without change the mesh's vertices) will keep the mesh's vertices closer to the origin (always 0,0,0).
Practically the two methods will have an huge difference when we'll go to rotate that mesh.
Above description explains only because the two methods are different, about the reason to use one or other, we'll do some experiment in this tutorial to explain better the matter (see How to modify the pivot of rotation chapter), for now, let's say simply that sometimes we could like to have a different way to rotate a mesh and, the movement of mesh, it's a good method to change drammatically the way to rotate it.
Once you typed a valid number for X, Y or Z axis, you can click on [Move Mesh] button to perform the repositioning of vertices for current mesh.
Usually you'll change only one of those three values, to move the mesh on that axis, letting 0 for other two fields.
Note: unfortunately there is no "undo" or backup that was able to restore previous vertices, execpting of course, saving the wad before changing the mesh and then reload it.
Anyway, if you are not happy about a repositioning of a mesh, to restore previous mesh, just simply applying newly a movement, on same axis but inverting the sign of previous axis, getting newly the original mesh.
For instance, if you alterated the mesh with {-100, 0,0} values (X Axis = -100), to restore old mesh, just perform newly this operation with X Axis = +100.
"Rotate Mesh" button
You can rotate the mesh over a given axis. To choose the axis just you type the degrees only in that Axis input box (X, Y, or Z) letting 0 in other two axis.
There is a big difference between the rotation you get with this tool, and that you set in Animation Editor...
While the rotations to animate the moveable, have always as pivot (the center of rotations) the origin of the mesh, i.e. its {0,0,0} 3d point, the [Rotate Mesh] button, will use as pivot the center of the mesh.
Look following picture:
In A picture you can see the two different points: the mesh's origin and the mesh's center.
Performing a rotation over Y axis by 45 degrees, you can see the two different outcomes: in B picture there is the rotation over Mesh's center, while in C picture you see the rotation over the Mesh's origin.
Notes:
- Probably it will not happen so often that you need to rotate a mesh of a moveable with [Rotate Mesh] button but it could happen for little adjustment, to fix some error in basic joint posture building
- If you want, you can type new center values in input boxes at top of "Edit Mehs" window, and they will be used as center of rotation. Anyway, if you use this chance, remind that the new center will be immediately updated in mesh data, in spite you have not yet clicked on [Ok] button to confirm the changes.
- If the moveable you are managing has only one mesh, you could rotate the mesh without problem with mesh tree, since a moveable with only one mesh, has .... NO mesh tree.
Direction of Rotation in Animation Editor's axis reference
I want remind you again how work the Animation Editor's axis reference: the blue axis is the negative side.
In above A picture, I added also the X (red) axis and Y (green) axis.
To discover how a mesh will rotate, in according with the sign of degree, you should remind that positive degrees will rotate in clockword direction, while negative degrees, in backward clockwork.
For instance, typing +90 in Y axis input box, we could rotate the dog's head (see above picture) in this way:
We'll get the head turned in above way (B picture). You shoud remind to see the axis in right dirction, and therefore, turning the 3d view, getting in lower side the -Z (C picture) you verify that dog's head turned by 90 degrees in clockwork direction.
"Semi-transparent mesh" option
You can enable or disable semi-trasparent attributes for all textures of current mesh. The semi-transparency it's a suggestive effect in some circustance
Note: the semi-transparency of a mesh, it will be not seen in Animation Editor but only in tomb4 program.
"Set as invisible" button
This command permits, in tricky way, to vanish current mesh, like it was missing, in spite it will work in the mesh tree as a joint.
There are some reasons because you could wish to vanish a mesh:
- If you are modifing a moveable and you don't want a given mesh but, on other hand, you don't want to pass through the steps to remove physically that mesh.
- If you want "removing", only temporarly, a mesh, only to look better other littler meshes that could be covered by the first.
Basically, there could be other ways to get a mesh invisible, but they have some collateral effects:
- You can cover a mesh with transparent (pink) textures but this is a wasting of GPU (Graphic Processor Unit) time, since the management of trasparent textures requires more computation than common textures. Differently a mesh set as invisible with this command, will be not really elaborated by GPS, since it has no polygon.
- You could modify the visibilty mask in moveable structures but this works only in runtime of tomb4 program, since the visibility mask is not stored in wad file, and so, you should create a code to enable in game it and, anyway, that mesh will come back visible in wad merger.
However there is also a collateral effect in this tricky way to vanish a mesh: if you save the wad file, while a mesh has been set as invisible, you'll be no ever able to restore its visibility. See also description of "Restore Visibility" button
"Restore visibility" button
This command works only with meshes that you had, previously, set as invisible.
The recovery of visiblity will work ONLY if you had set as invisible the mesh, in current runtime of wad merger. Said in other way: if you set a mesh as invisible, and then you save the wad file and then, later, you reload that wad file, it will be no more possible restore the visibility of that mesh.
"Copy" and "Export" buttons
You can export the selected mesh in mesh names frame with these two buttons.
The only difference between "Copy" and "Export", is that, with "Export" button you can save the mesh to a specific file (with ".WadMesh" extension) while with "Copy" button the mesh will be saved to clipboard.
Another difference will be that, of course, to use a mesh copied with [Copy] button, you'll have to use the [Paste] button, while to use the one exported with [Export] button, you'll use the [Import] button.
In both cases, the exported mesh could be copied to replace any other mesh in any moveable of any wad file. Also the [Copy] button has this feature, differently by other copy/paste operations that usually lose the clipboard data, changing wad file or quitting and then relaunching the program.
Note: about [Export] button, you cannot chose the folder where save the file, since all exported meshes will he saved to "Exported_Meshes" sub-folder of wad merger folder.
Anyway, if you wish, you can later move these files to other folder, of course.
"Paste" and "Import" buttons
These buttons are the mutual twins of [Copy] and [Export] button, of course.
After you copied a mesh with [Copy] button you could use it with [Paste] button, while [Import] button will be used to laod a ".WadMesh" file previously exported with [Export] button.
An interesting option (available in both [Paste] and [Import[ buttons) is you can replace the current selected mesh with that you are pasting/importing or (second change) adding the new to the older one.
In this case (chosing [No] in msgbox) the new mesh will be "pasted" to the original.
To explain better let's use above pictures...
Let's say we export the Von Croy's head (A picture) and then we import it to dog's object (B picture).
If you import with replace (selecting [Yes] in import msg box) we'll get the C picture. The dog's head vanished and there is only the Von Croy's head (please note that, the dog's head doesn't include the jaw, so ti will remain always.
While if we choose to add new (imported) mesh to the original, we'll get the D picture.
Ok, no one of above is really "cool" but in some circustances it could be usefull add some details (or "gadget") to an already existing mesh.
When we choose to add a new mesh to the orginal, we could need to fix the relative position of new mesh or its size or inclination.
Usually the command to scale, move or turn a mesh, should work on whole mesh (since, at end of the story, the "head" is only one mesh, it doesn't matter how many adding of other mesh we did).
Anyway, to permit to fix only the just imported mesh you can use common commands like: How to move, scale or rotate vertices of a Mesh in Animation Editor but, to avoid to affect whole mesh (old and new) you can keep down the SHIFT key or CAPS-LOCK key, while you are dragging the arrows icons.
For instance,in above example, if we wished move a bit the von croy head respect the dog head, just you select the head and select the [Meshes->Move mesh] menu command and now, before dragging the mouse over some grabbing icon you enable the CAPS-LOCK key (or the SHIFT key) in this way you can get below outcome:
You can see different position of "von croy" mesh in above picture.
You can perform these partial operation (partial because they work on only a part of the mesh, that just imported), also with scaling or turning, always using same "trick": with CAPS-LOCK or SHIFT on.
Important remark: this chance to act on partial mesh just imported, it will work only in current wad merger section. It means that, if you add a new mesh to an old mesh, until wad merger is yet working you can affect also only the new added mesh (with SHIFT or CAPS-LOCK) but, if you quit wad merger program, and then launch it newly, that mesh will be only one mesh and there is no more a distinction between old mesh and new mesh.
This happens for a technical limitation: there is no field (saved and the reloaded from .wad file) where to store the vertex number from where begins "new", just added, mesh. Anyway, there is a command to read or set this value: the SHIFT P keyboard command. So, if you wish, you could, after having added a new mesh over another, use the SHIFT P commad to discover the vertex number and then you could save it. Then, later, when you launch newly wad merger,you could load newly that wad file and object in animation editor, select the mesh slot you used in that importin operation, and now use the SHIFT P command to set newly the vertix number you had saved. From this moment you could act newly only on new, last imported mesh with some 3d operations as explained above.
"Transpositions" frame
Transposition values are relative coordinates that each (child) mesh has, respect its parent.
Only child meshes have transpositions and, for this reason, mesh0, that is always the root mesh, has no transpositions.
The 3d coordinates: x, y and z, are the the distances between the mesh origin and the origin of its parent.
Let's try to explain better how they work
Understanding Transposition values
Let's give a look to above image. Those yellow points are the origins of each mesh, and it will be between the distance of these point that it will be computed the transposition,
performing the subtraction: {Child Origin) - (Parent Origin) we'll get the transposition values for the child mesh.
Since each point is given by tree coordinates, there will be three values:
Transposition_X = Child_X - Parent_X
Transposition_Y = Child_Y - Parent_Y
Transposition_Z = Child_Z - Parent_Z
To understand because the origins are those showed in above picture, let's see the below picture, where you can see each single mesh structure:
How we can see, that yellow point is simply the origin (0,0,0) in the given mesh.
For this reason, when we'll build meshes for a new moveable, it will be very important where is the (0,0,0) point respect our mesh, because that will become the "joint" from current mesh and its parent, i.e. the point used as center of rotation (pivot).
"Update" button
Once you modified some x,y or z value for transposition, you can update its value with [Update] button. (Note: the true update, in mesh tree of moveable, will happen only after you quit NTB window with [Ok] button).
This chance is useful for little adjustmente, when you want move (for instance) an arm a bit up or down (or at left or right on some axis) but it's non reasonable to use this method to build from scratch the whole mesh tree.
About how to interpret transposition values read also previous paragraph Understanding Transposition values
It's important that you understood very clearly axis and their directions, to be able to correct joint positions.
See below picture.
Above there is the axis system used by Wad Merger.
Look the x, y and z axis and their direction, given in above image by +/- signs.
When you want moving some mesh you should using same signs on given axis to get that correction.
For instance, starting from this basic joint posture (no animation):
Let's say that we want move the mummy's head...
We'll have to enter in NTB window and select the head's mesh:
Now we could perform some experiment...
For instance if we want move upward the head, we should move in [-] direction on Y axis and so, adding a negative value to the current Y transposition value.
Since nornal Y trans was -162 we could add -100 to get -262, click on [Update] button and then quit NTB window with [Ok] button and let's see what happened:
So we can verify that the head moved up.
Now let's come back in NTB window, restore old Y trans value (-162) and let's change another value, for instance X transposition that, now, is -2.
Lets say to add a negative value, for instance - 200, so we'll get (-2+ -200) -202.
Now we update and quit with [ok] button NTB window and we'll see this:
Now the last experiment, on Z axis.
We restore the standard values {-2, -162, -20} but now we modify the Z transposition, for instance adding 200 to -20, getting 180, and this will be new position of the head:
In this way we've had the confirm about the direction of all three axis.
Another way to modify Transposition Values
I remind you that, from 1.1.0.0. version, you can modify transposition values also from Animation Editor interface, whereby the menu command: "Meshes/Move Mesh"
When in Animation Editor has been loaded a multi-mesh moveable, this command will move the mesh joint of currently selected mesh.
The advantage of this method is that you can see in real time this movement, adjusting it in finer way whereby drag icons for moving/rotation.
Some execptions about axis rule
In previous paragraph we saw how transpositions work on different axis, unfortunately there are some execptions that could get a bit harder this matter to understand.
The problem is that the transpositions work on child meshes but they are always refered to their parent mesh.
When the parent mesh was not in most common position (in basic joint posture) the further rotation of mesh parent will affect also the child mesh, getting the weird situation of a sort of rotation of child's axis.
Let's see an example to understand this complication...
We'll use the Skeleton moveable for a in depth analysis.
Please note that, the above image has been taken from Basic Joint posture, so it is not from an animation, this is very important difference, as we'll see.
(Note: to get visible above image you'll have to scroll down the 3d view because skelton start from a low underground position)
Now, let's get another image of skeleton but, this time, taken it from a common animation (frame 0 of animation 1)
You could notice that the sword (holded in right hand) has a different rotation in basic joint posture. That is the problem!
Anyway now let's try to move the right hand with sword, like we did with mummy, let's say to move at left in above image and so following +X axis.
So we'll add a positive value to transposition X for right hand.
The x trans was 10 and we add 200, so we'll type 210 and then [Update] and [Ok] button, this will be the outcome;
It looks like the right hand had been moved on Z axis, but we had changed the X transposition value. Why did it happen that?
To understand this mystery now let's come back to see the basic joint posture of skeleton (choosing [No animation] in animation list box), to verify how our change affected the basic joints
In this (above) case the movement has been that we wished: the right hand (with sword) moved own at left, a + movement on X axis, as we set but... why in animation 1 it look like a movement on a different axis?
Because to reach the position of animation 1 there is a rotation of 90 degree of the sword and, if you, looking above image (of basic joint) think about this rotation, then you'll get that is normal that it becomes that we saw in animation 1:
That rotation of about 90 degrees, affect a rotation also on axis reference for child mesh that we could also see using Rotate Mesh window in Animation Editor:
Did you see the colors of micro axis for sword? Animation Editor, correctly showed us the new reference of relative axis for child mesh and you could notice that the red axis ( X axis) now point in same direction of absolute Z axis (that you could notice down and behind, on the ground, that blue line).
This complication is a bad news, anyway there two good news: the first is that there are a very little minority of moveables with a so bad basic joint posture, the most will have the basic joints in a very common position. (Only skeleton, for sword, wildboard and (a lot) the jeep, have this problem). The second good news is that, also if you are not able to understand this exception, there is a easy way to solve the problem: performing some attempts. You'll need just (max) only three attempts to discover on what axis moving the mesh in according with your change, or, other trick, select the mesh in its animation and look the colors of its axis.
"Scale factor" frame and "Multiply by" button
To change the scale factor means modify the proportional distance between all mesh joints and, if you want, also the size of every mesh of current moveable.
In the text input box, you should type the new scale factor.
For instance, if you type "2.0", the moveable will double its size, while with "0.5" it will become the half, ect.
NG Tree Builder will perform also some required adjustments about the position of the object.
Indeed, modifying in proportional way the size of the meshes and their distance (position of mesh-joint or their trasposition values) could get an object that had no more the "feet" (supposing it had them) on the ground but, flooded below the ground (magnifing it) or floating over the groung, getting it littler.
In spite NTB perform all required changes it's important understand that it's not sure that, later, that moveable will work fine in game, since there are many hardcoded management in tomb4 that use old moveable's size.
For instance it's not possible trying to change the size of Lara (in strong way) because a lot of her skills will be lost.
Anyway, if you are able to work with plugins, you could (enough) easily change some code (with callbacks for instance) to adapt the object to its new size.
Some experiment of resizing moveables
We could start with Skeleton...
To get a lillput version of skeleton, just:
- Load skeleton in Animation Editor
- Click on [NG Tree Builder] button
- Type (for intance): "0.2" in text input closed to [Multiply by] button
- And then click on [Multiply by] button.
NTB will ask you on what axis you want apply the new scale factor:
We'll let all axis: xyz
Click on ok and now, answer "yes" when NTB will prompt you if perform a resize also of the meshes.
Little skeleton
Once got off by NTB window, we could see our very very little skeleton (five times littler than original)
And now, let's see how this little monster works in game
Not bad, really.
A moment ago I said that there could be problem to work in game, anwyay some enemies could work enough fine, without adjustmen.
About the skeleton, we have not yet seen him jumping and problably there will be some weirdness in that case, but I noticed that he is able to hurt lara from right distance and also the blood is in a correct position.
For sure we'll have more problems with giants, for the collison box that, beyond some size will not work fine. (probably I'll have to do some mods in tomb4 to support extra big enemies...)
Now try to get a skeleton bigger than double of original and let's see how it works in game.
Giant Skeleton
If you start from our lilliputian skeleton we'll have to resize it to its normal size with a 5.0 factor.
Now (starting from normal skeleton) we could try to double its size, so we'll use a 2.0 factor and then we could try in in game...
It's enough fine also this but, a curious fact, this giant will hurt lara in same way of the lilliputian version. So it will be necessary change its strong to hurt lara but this is already possible in trng.
"Load Transposition" button
You can load transposition values of current moveable, previously saved to a ".trans" file.
"Save Transpositions" button
To save all transposition values to a ".trans".
You could use this chance to perform different attempts and, after having saved a set of transpositions, later, reload it to come back to previous set.
The save/load features are also useful to transfer a set transpositions from a moveable to another.
"Compute Transpositions" button
This button will show the Transposition Analyser window
Transposition Analyser window
The target of Analyser will be exaplained better when we'll talk about creating new moveables from scratch.
Anyway, as a shorter description, the Transposition Analyser is able to help you to create a full set of transposition values, starting from a Basic Joint Posture mesh that you created. In this way you'll be able to make visually your mesh tree, using Metasequoia, and then the Analyser will scan your basic joints mesh to create correspondent trans value for all sub-meshes of your new moveable.
"Basic Joint Posture mesh" text box
In this text box you type the absolute index number where you stored the full basic joint posture mesh.
For "absolute index" we mean the index for a mesh in the wad file that you can see in StrPix program.
You can store your Basic Joint Posture mesh, in any mesh slot, also that of a static object. The Basic Joint Posture mesh will have all sub-meshes of your moveable, placed in the basic posture you chose.
"Compute Transposition values" button
When you click on this button, the Analyser will look for every single mesh of current moveable, in the Basic Joint Posture mesh, trying to locate its position. Then, when it has been located the position of each slot-mesh in the basic joint posture mesh, it will compute the relative distance between each slot-mesh and its parent mesh, building the transposition values for it.
It's important understanding how it works, because we'll have to take care of same rules when we are going to build our Basic Joint Posture mesh:
- All single slot-meshes should be unique. Indeed, in the case there were two or more slot-meshes with same shape, Analyser could be not able to locate with certainty the position of a given slot-mesh in the basic joint posture mesh, since there will two or more "same" meshes in different positions
- When you build your Basic Joint Posture mesh, you should take care to do not modify in anyway the slot-meshes you used to build it. This means the you'll insert in metasequoia a slot-mesh and then we'll be able only to move it in wished position, but it will be not allowed rotating, scaling or peform any other kind of modification on it.
For this reason, and in particular way for first of above rules, the Analyser, before trying to locate the slot-meshes, will verify that all slot meshes were differents. In the case it found two or more duplicated meshes, it will abort the operation, giving you a report about the duplicated meshes that it found.
"Get meshes different, if it will be found a duplicated" option
The option works in according with the operation to check for duplicated meshes that you can perform with [Check for duplicated meshes] button
If you enable this option, when Analyser will find duplicated meshes, it will modify them a bit to get unique each mesh.
While, in the case you let unchecked this option, Analyser will not modify any mesh but it will show only a report about if, or, what, meshes are duplicated.
The only reason to do not let Analyser to modify the duplicated meshes, is if you want perform yourself that job. This choice could be smart, because the Analyser, like it happens for all programs, it's not really smart, so it will change randomly some vertices but they could be very visible, while a person could try to modify only hidden vertices, to get less visible these mods.
Anyway, about this speech, I want remind you that this requiremento to have all meshes as unique, it's necessary only to do compute by analyser the transposition values for your moveable, but, once you got those values, you'll be able to modify newly your meshes as you wish, also cloning many of them without problems.
"Check for duplicated meshes" button
This command will work in different way, in according with "Get meshes different, if it will be found a duplicated" option. See above paragraph.
All meshes of current moveable, will be compared between them to verify the presence of duplicates.
The procedure is able to detect as "duplicated" also mehses that have a different origin but same shape.
"Reset of animation data" frame
Perhaps it's better explaining why to have here, in this window to change transposition values, this tool to remove animations from current object.
The logic is that, when you build a new moveable from scratch and you want also change all transposition values, probably you could prefer also to remove all old set of animations of previous object, since, with different transposition values (and meshes, proabably) all animations of previous object will be useless.
"Clear all animations (except one)" button
With this command most of animation data of current moveable will be removed.
You know, by default, (*) Wad Merger didn't allow to delete an animation and, for this reason, it could be annoying having a lot of useless animations in own moveable's slot.
This command allows to remove all this garbage and, in specific way, this it will do:
- Remove all animations except one, the first
- Remove all frames (except one) by the only one animation
- Set the only one frame to have no rotations or movement
- Remove all anim-commands linked with previous animations
- Remove all state-changes linked with previous animations
(*) Note; anyway, from trng_fixer 1.1.0.0, it is possible removing animations but only one at once and always the last.
With this command you can free all that stuff, and restart from first animation with the object in standard posture (the same of Basic Joint Posture)
Note: after this command, it's advisable don't work too much with wad merger. It should be better, once you gave the reset for animation data, saving the wad, quitting wad merger and then launching it newly, and, at end, reloading the wad.
"Use mesh names also in Animation Editor" option
If you want having descriptive names for meshes also in animation editor's list box, you can check this option.
When there will be a .nmf file (with names for meshes) for the slot of moveable in Animation Editor, the "meshes" list box will show those names, insteady by usual generic "mesh 0", "mesh 1" ect.
How to move, scale or rotate vertices of a Mesh in Animation Editor
In spite this topic is not exaclty about Tree Builder, I explain here better some commands in Animation editor, to perform 3d operation of meshes, since they are not so clearly visible.
You can move, rotate (turning) or scale a mesh of a moveable, affecting directly the vertices and without changing the rotation angles of animations, or the transposition values of mesh tree.
Basically, you could get same outcome of "3d Tools" frame of Edit Mesh window but, from animation editor you could adjust these operation seeing in real time the mesh while it's changing.
These commands works only using drag icons.
To move mesh or to scale mesh
To rotate mesh
Moving vertices of a mesh
I remind you (newly) that this moving it's not based on changing transposition values (stored in mesh tree data) but on vertices that will be moved to wished direction. You should use this operation only to fix some little misplacement of some mesh and this change will affect all animations of current object.
- Select the mesh you want moving
- Select menu command: Meshes/Move Mesh
- Now move mouse arrow on drag icon of wished axis
- Now hit and keep down SHIFT key, or, enable CAPS LOCK key
- Now you can drag the icon as usual, with left click mouse down and moving the mouse in wished direction
The "tricky" thing to know is the SHIFT or CAPS-LOCK key to hold in the moment you are dragging the icon. It's own this key to change the normal behaviour of this command, indeed, if you forget the SHIFT/CAPSLOCK key, this operation will change the transposition value of that mesh (and not vertices of it). While with SHIFT/CAPSLOCK it will be the vertics to be moved letting uncanghed the transposition values.
Scaling (to change size) of a mesh
To scale (change size) a mesh you have to follow these operations
- Select the wished mesh
- Choose menu command: Meshes/Scale
- Hold SHIFT or CAPS-LOCK key
- Drag arrows icon
Note: in the reality, in the case of scale mesh (differently by moving and rotate operations) there is no possible ambiguity about final target, for this reason it's not necessary use the SHIFT or CAPS-LOCK key. Anyway there could be some difference if you use or less SHIFT / CAPS-LOCK key:
- With SHIFT/CAPS-LOCK if the current mesh has had a recent importing mesh (adding new mesh to original mesh) the scale operation will affect only new mesh
- If you don't use SHIFT/CAPS-LOCK key, you need to have a selected animation in Animation Editor, otherwise you'll get a error message. Differently, if you use SHIFT/CAPS-LOCK you could scale a mesh also when there is no selected animation.
Turning vertices of a mesh
To turn a mesh, working only on its vertices and not on angles respect parent mesh (as it happens in common animation) you have to perform following operations:
- Select the wished mesh
- Click on rotation icon at top left corner of Animation Editor
- Hold SHIFT or CAPS-LOCK key
- Drag icon of wished axis
Notes:
- if you omitted to use SHIFT or CAPS-LOK keys, the turning will be performed as a common animation.
- When you use SHFIT / CAPS-LOCK mode, the center of rotation will be the mid point of the mesh, while the rotation in common animations use the pivot of the mesh, usually placed very close to the joint to its parent mesh.
Different kinds of mods on Moveable Mesh Tree
Little adjustments on mesh joints
This operation is rather easy, just you keep in mind the notions showed in Understanding Transposition values and "Update" button chapters, to understand how to work.
Changing the size, preserving its meshes and proportions
We have already seen how NTB is able to perform automatically these mods. See Some experiment of resizing moveables
Moving joints in substantial way
In this case, for "substantial" way, we mean to change completely the shape of an existing moveable but preserving the meshes of original moveable (preserving, in the meaning of number of meshes, not their shape)
It could be complicated to perform many changes only in "manual" way, changing trasposition for transpostion but in some circustances it could be possible.
For instance we could change jeep moveabe to give to it the look of a different vehicle.
Modifying the jeep in a monster car
In this case we'll not use the full resize feature with scale factor, because, in that case, we could have only a bigger jeep but a monster car has a different look. The wheels are huge, while the rest of body is almost normal.
So, with this target, we'll have to perform manual changes on different meshes and joints. (Note that when we talk about joints or mesh positions we are, practically, always talking about transposition values).
So, load the jeep in animation editor, set some animation, because the basic joint posture of jeep is a bit messed. (For "basic joint posture, we mean, the position of meshes outside any animations, how when we see the moveable with "no animation" selected).
As first step we'll have to get bigger the size of the wheels and only those.
For this target we'll use the [Edit Mesh] window to change the scale factor only for these 4 meshes.
We'll use a factor 3, to have wheels bigger than three times of original.
Clicking on [Multiply by] button of "Edit Mesh" window we'll change its size.
Now we'll repeat same operation for other three wheel, then let's go to see the outcome...
Uhm ok, it is enough monstruous but not like we wished.
Now we should move up the body and many other meshes (doors, windows ect) but, since they are a lot, it is easier moving down only the four wheels and then, at end, we could move the whole jeep upper, to be at level of the ground.
Note: before modifying transposition is safer saving current transposition values, to have the chance to come back to previous values in the case we made some mistake. This operation should be useful before every attempt So we click on [Save Transpositions] button and we save current values to a file, for instance "jeep_standard"
To move down the four wheels, we should change their Y Transposition value, adding a positive value but in this case ... it will not work!
Let's say to begin with front right wheel and to move down it by 500 units.
So we'll change the y value from 219 to 719. Clik on [Update], click on [Ok] and let's see this weirdness:
The wheel moved on X axis, instead y axis and in negative way, instead by positive values.
Ok, this is a complication but, for us, it's not a surprise. (See the Some execptions about axis rule paragraph)
Since the basic joint posture of jeep is absurdely messed, it was predictable.
Now we'll have to guess what it should be the axis to use, to get our "downstairs" of the wheel.
Let's see the basic joint posture of the jeep
I've said that it was messed, and now, with huge wheels is also worse, anyway.. take care to look at that blu line: that is Z axis.
To understand better we should look by two different views:
From B picture, we understand a bit better. Since we want the wheel was downstairs of the jeep, the direction should be that opposite than -Z, therefor +Z
So let's try to add +500 to z transposition of the front right wheel. (Anyway, before doing this we have to remember to restore original values, loading them from "jeep_standard" trans file with [Load Transpositions] button)
Now we add 500 to original z trans (it was -6) getting 494. Now let's see what happens
Oh, finally we got right movements.
Now we'll apply same +500 on Z axis also for the left front wheel.
If you notice the original value of left front read was the same of right wheel -6, this is a good signal that it could work.
Let's see...
Ok, it's gone fine.
Now let's try to work on z axis also for the two left wheels. They have both -251 as Z trans, adding 500 we'll get +249
Failed attempt!
(A bit stressing working random)
Let's try with Y axis. Undo last (good) transposition and try to add 500 to Y axis. It was 10, so we'll get 510.
Let's try.
Ok, it's good this time.
From now I'll perform attempts for you.
Now we have to increase the distance between two pairs of wheels in both directions: between the two (right)/(left) pair and between two wheel on same side.
To discover the axis to get more distance between two wheel on opposite side, we can verify what transposition value, for the two wheels is the same,execpeting the sign.
Since the two transpositions are:
9: Wheel (right/front) 232 219 494
10: Wheel (left/front) 232 -249 494
We see that is (about) the Y transposition, while other two (z and x) have same values.
So we'll increase the distance between them, adding some value with different sign to both Y transposition value.
For instance +200 for right wheel, and -200 for left wheel.
Ok!
Not try to guest also the axis for rear wheels:
12: Wheel (left/rear) -235 510 -251
13: Wheel (right/rear) 233 510 -251
In this case it seems X axis that with opposite signs.
So we'll incease the bigger by 200 and we'll decrease the littler by -200.
Well...
Now we should icrease the distance between two wheels on same side. Let's compare their transposition values:
X Y Z
9: Wheel (right/front) 232 219 494
13: Wheel (right/rear) 233 510 -251
After some attempts these are correct new transposition values for all wheels:
X Y Z
9: Wheel (right/front) 382 419 494
10: Wheel (left/front) 382 -449 494
11: Axie (rear) 149 10 -169
12: Wheel (left/rear) -435 510 -351
13: Wheel (right/rear) 433 510 -351
And this is the outcome:
Now we could change yet a bit the size of the wheels, because they are huge but a bit slim, considering their size.
To increase (by double, let's say) only the size of the tire tread.
To discover on what axis we should change scale factor we have to see the Basic Joint posture:
So, it should be on X axis.
Now we'll use [Edit Mesh] button to change the scale factor of all wheels but now we'll work only on X axis with factor = 2.0
And this will be the outcome:
Ok,now we should move down axies, to have them in the middle of wheels and get them bigger to cover the new distance but ...I'm fed up!
I'll let to you this final job, as homework.
Anyway there is an important operation to perform now: moving up the whole jeep, because actually it is a bit too low, flooded in the ground:
So, now we click on "Frame Adjustment" button and will set a negative value to add to "Y" axis, to move up the monster car.
I performed some attempts and I found that -780 works enough fine.
We could consider completed this exercise on monster jeep.
It will be not easy using really in game this monster jeep, of course. We should change the get-in animation for lara (and give to her a staircase) and give some special feature to this monster car, but our target was only that to explain how to perform selective mods to transposition values or scale factor for some mesh.
Removing joints and/or meshes from a movable
Now we'll try to modify an existing moveable, removing some meshes and joints.
Transforming a scorpion into a Spider
Let's say that we want transforming the red little scorpion (taken from settomb wad) in a spider.
We'll have some job to do...
We could remove the long tail and then modify the claws to convert them to ohter paws, since spiders have 8 paws and not only six.
Let's begin with removing the tail.
We could perform this in two ways: setting those meshes as invisible (easiest trick) or removing physically them.
We'll use both methods, because this is a tutorial and our target is only to understand better how using these "tools" to modifiy moveable mesh tree structures and, it's not really, getting only a stupid spider.
So we'll get invisible the tail's meshes, while we'll remove physically some claws.
We select a tail mesh and then we'll set as invisible (see above picture).
We'll have to perforom this operation for each "tail" mesh and also for the stinger.
Then let's look the outcome.
Uhm, ok, but perhaps it's better getting invisible also abdomen and butt
Since they are not parent of paws. (It should be better don't get invisible meshes that are parent of other meshes that we'll let visible).
Ok, let's get invisible also mesh abdomen and butt...
It's not so pretty, is it?
Now we could set an animation in Animation Editor, for instance animation 0, frame 0, to see a posture more realistic of this object.
Ok, it's not so bad, also if surely we'll have to change the shape of same mesh and probably also their textures.
Anyway now we have to fix the problem about claws that are very different than paws.
While paws have only two mehses the claws have three meshes, so we'll have to remove that third mesh from each claw.
Let's say to remove the "down" claws:
23: Claw down (Left) 0 0 61
and
26: Claw Down (Right) 0 -1 62
In this case, we'll remove physically these two meshes. It will be a bit more problematic but we have to learn also this method.
As first step, we save the wad file to have an "undo" copy if something had to go badly.
Now, to remove physically a mesh, we have to use the old "Mesh tree Editor" (did you see? It is yet useful).
It's always better delete earlier last mesh, that with bigger index number (and indeed, it' s not a case that we got invisible tails while we'll remove physically claws: removing physically tails should have been a very hard job, since they had a lower index).
So we click on mesh 26 (the highest mesh's index to remove) and click on [Delete]
Now quit "mesh tree editor" and let's see what happened.
Above image has been taken from basic joint posture and it's clear that right-down claw vanished.
It looks fine but, when we try to select different meshes of scorpion (using the "meshes" list box of animation editor) we discover to be not able to highlight the right end claw.
This is a bug in animation editor (that I've not yet been able to fix): the meshes list box is a bit confused after the removal of that mesh.
To solve the problem just saving the wad, quit wad merger and then launch newly wad merger and reload the wad.
Now we can try and finally we are able to highlight also the right-end claw:
Now we could give a look to some (random) animations to verify that all is still working fine and now we will delete also other mesh:
23: Claw down (Left) 0 0 61
Now we can to verify the situation:
Ok, it's gone but we have yet previou bug: we are not able to select the right-end claw mesh. So we'll save and reload the wad file..
After reloading, we can verify (looking some animations) that all looks fine.
At this point we have to perform a change that, in spite it was not specific of "mesh tree" topic, it's necessary to go on: we have to modify the shape of claw meshes to get them same look of paws.
For this job we'll use well know tools and procedures:
- We'll use strpix program to perform a "copy and paste" operation between Scorpion's meshes
- We'll export some paw meshes and then copy them in claw's slots
Before doing above job, we have to fix a problem in NG Tree Builder...
SInce we have removed some meshes from scorpion, now some meshes' names are wrong.
We have to fix them manually and then save the new .nmf file as "scorpion.nmf"
We should change last two meshes' names in this way:
23: Claw Start (Right) 13 4 29
24: Claw End (Right) 83 -1 33
--------------------------------------------------
Now we make a little table to understand how to handle the "copy&paste" job in strpix:
SOURCE TARGET
-------------------------------------------------
9: Paw Start(Left 1)-> 21: Claw Start (Left)
10: Paw End (Left 1) -> 22: Claw End (Left)
19: Paw Start (Right 1)-> 23: Claw Start (Right)
20: Paw End (Right 1) -> 24: Claw End (Right)
-------------------------------------------------
To understand what is the mesh index in StrPix program we could discover the first mesh (0) of scorpion, using NGLE:
- Launch NGLE.exe
- Load a project using same wad file with our scorpion
- Click on "select object" zone
- Scroll the object's list untile we see "small_scorpion"
- And now look at value in "RMI" (Relative Mesh Index) for small scorpion
In my case I have this outcome:
And the first mesh is 157 (take care: for you, it could be a different value)
Now we could rewrite our (above) table updating the mesh indices with this strpix index. Just simply adding 157 to the relative mesh indices.
So (for me) the table will be:
SOURCE TARGET
-------------------------------------------------
166: Paw Start(Left 1)-> 178: Claw Start (Left)
167: Paw End (Left 1) -> 179: Claw End (Left)
176: Paw Start (Right 1)-> 180: Claw Start (Right)
177: Paw End (Right 1) -> 181: Claw End (Right)
-------------------------------------------------
(new table with mesh0 in strpix = 157)
Now let's load our wad file in StrPix and perform exporting .dxf for the mesh at left in above table, and then import of corresponding .dxf file to mesh at right of the table.
Since these operations are all in same wad file, we'll get meshes already texturized.
Now save the wad file and load it in Wad Merger to see the outcome.
Ok, the look of new paws is good but there is some problem about the relative position of them. We'll have to fix this problem modifying the transposition values for two (new) end paws.
Looking at above picture, it loos that we should move the paws on Z axis, moving in negative direction.
So we'll add a negative value to z field of transposition values for both paws.
Looking about Z value for other (old) end paws, we see that z is always 0. Could it be enough that? Setting 0 also our new paws?
X Y Z
----------------------------------------------
10: Paw End (Left 1) -79 0 0
12: Paw End (Left 2) -79 0 0
14: Paw End (Left 3) -79 0 0
16: Paw End (Right 3) 79 0 0
18: Paw End (Right 2) 79 0 0
20: Paw End (Right 1) 79 0 0
Let's try, indeed it should be like adding -30 to z values.
Ok, it seems working! We fixed the problem on z axis but there is yet a little empty between start and end (new) paws.
We should work on X axis in this case, getting the end claw closer at its start paw.
(Note: there could be also another chance: to increase the length of start paw, to reach the its end paw, but now it's intersting working on transposition values to fix these problems.
The distance to remove is really very little. Probably we could discover that distance (another time) looking at distance between ohter old paws.
X Y Z
-----------------------------------------------
10: Paw End (Left 1) -79 0 0
12: Paw End (Left 2) -79 0 0
14: Paw End (Left 3) -79 0 0
16: Paw End (Right 3) 79 0 0
18: Paw End (Right 2) 79 0 0
20: Paw End (Right 1) 79 0 0
22: Claw End (Left) -86 -1 0
24: Claw End (Right) 83 -1 0
-----------------------------------------------
It looks was the 79/-79, while our new paws have -86 and 83.
OK let's try: set -79 and 79 for our new end paws on x transposition.
Perfect!
If you lost some steps, in below table there are the correct transposition (and name) values for our scorpion (until now):
MESHES OF SLOT 106
## NAME X Y Z
--------------------------------------------------
0: Chest 0 0 0
1: Abdomen 0 12 -39
2: Butt 0 -5 -36
3: Tail 1 0 -24 -29
4: Tail 2 0 0 -33
5: Tail 3 0 0 -34
6: Tail 4 0 0 -32
7: Tail 5 0 0 -33
8: Stinger 0 0 -55
9: Paw Start(Left 1) -23 6 -26
10: Paw End (Left 1) -79 0 0
11: Paw Start (Left 2) -23 6 -7
12: Paw End (Left 2) -79 0 0
13: Paw Start (Left 3) -20 6 11
14: Paw End (Left 3) -79 0 0
15: Paw Start (Right 3) 19 6 11
16: Paw End (Right 3) 79 0 0
17: Pawn Start (Right 2) 23 6 -7
18: Paw End (Right 2) 79 0 0
19: Paw Start (Right 1) 23 6 -26
20: Paw End (Right 1) 79 0 0
21: Claw Start (Left) -12 4 26
22: Claw End (Left) -79 -1 0
23: Claw Start (Right) 13 4 29
24: Claw End (Right) 79 -1 0
--------------------------------------------------
Looking the spider (now, it is a spider!) in some frame, we could notice that it looks really like a spider
How to replace a mesh
For those were our targets, the exercise, about the scorpion/spider, could end here, anyway there are some infos to know about how to replace meshes in a movables, preserving the correct mesh joints.
Therefore, now we'll change the main-body mesh (called "chest" in NTB window) with another more spider-like, to give some more infos about this matter.
Importing old mesh in MetaSequoia
First rule is to start always from old mesh, importing it in MetaSequoia, to have a reference about its size, facing and position respect 3d origin.
To import in Metasequoia .dxf file exported by StrPix I suggest strongly to use these importing/exporting settings:
About the axis reference, we could notice that it is different than that used in WadMerger. The only one axis that has same direction, is the blue Z axis but, ironically, since wad merger paints only the negative side of Z axis, while Metasequoia paints only the positive side of axis, they look different but it's not true: the direction of Z (blu) axis is the same for wad merger and Metasquoia. While all other axis are inverted but this is not a so big problem...
Looking above image we can see the difference between axis used in two programs, anwyay the good news is that you have not to worry about that.
Only thing to remember is that, the side you see of blu z axis in Metasequoia is in inverted direction respect Wad Merger but when you'll build some detail in Metasquoia, it will appear in same position also in wad merger.
For instance, if we added some mesh "over" the scorpion's body (see above picture) using Metasequoia, then, that new mesh will be own over the body also in wad merger.
Also if we added a mesh at right of the body, that mesh will appear at right in Wad Merger, therefore... don't worry.
Only fact to keep in your mind is that, when in Metasquoia you see the "painted" blu side of the Z axis, remember that direction is main forward direction, where, in tomb raider the moveable move to. For instance, animals, baddies, Lara or vehicles will move from -z to +z direction. Practically, in above picture, in Metasequoia's side, the blu axis is where the scorpion will move, while in Wad merger the blue axis is behind the object.
Note: Take care to use the right Metasequioia release to work with .dxf StrPix files, it is the Release 3.0 LE.
Above is the "About" window of correct release.
Modelling a Black Widow's body
Now we'll change the scorpion's body to get a Spider's body, and I'll try to get it similar to a Black Window spider.
The shape to create, it's a matter of personal feeling but it's important using the old mesh as reference to know how place the new mesh.
For this reason I'll not remove immediately the old mesh but I'll build the new mesh at its side and, only at end, after I'll have placed the spider's body in correct position, I'll delete the old scorpion's mesh.
In this way I'll be able to move the new mesh in correct position, where there will be right joints in moveable
And only at this point, I'll select only the old mesh (Using the "Select" window in "Joined Faces" mode) to select the old mesh and remove it.
At this point, we'll have to do usual operations:
- Save the object in .dxf format, following the exporting rule showed previously
- Importing the .dxf file in WadMerger, to given mesh's slot
- Texturizing the new mesh
- Saving the wad file
- Loading the wad file in Animation Editor
Now, let's see the outcome in Animation Editor
Ok, texturizing is not my cup of tea, I chose randomly textures,anyway above this bug: it looks really like a spider!
To use it in game we should change a lot of animation, to do move the (old) claws, like paw (that I did to get above picture). Then we'll should surely change its attack animation, since scorpion hurts Lara usign its stinger but a spider attacks in different way. We should modify that animation to get that the spider move upper its head to bite Lara.
Anyway, about our target to explain mesh tree stuff, the exercise ends here.
Creating a new moveable from scratch
Now we'll try to do the hardest thing: creating a new moveabel from scratch.
We'll build a new set of meshes and then we'll create mesh tree for them. At end we'll have to build a set of animations for our moveable.
Projecting a really new moveable
As first step we should project our new object. Since in this chapter of our tutorial, we are going to describe how to build a new moveable from scratch, it should be meaningless projecting a generic quadruped animal, alike than dog, wildboard, and neither a vehicle like a quad, because for these target it should be better starting from an existing (alike) moveable and then perform on it, only little changes. Therefore, we'll choose a really new moveable, that we had never seen in tomb raider adventures until now: a large snake, let's say, an Anaconda.
It will be very large and, usefull for our targets, it will have very different joints than other human enemies or quadruped animals.
Our first project's release could be a simple 2d image, to understand the shape of the movabel and how many meshes it will require.
Then we'll have to build each mesh with Metasequoia program.
Our Anaconda: choosing the root mesh
We have to set also the root mesh, because it will be the position of that mesh, to set the origin of whole moveable.
It is important that it wasn't a too mobile mesh (like the head) because, otherwise, everytime we'll have to turn it, the whole moveable should turn.
Anyway, with our Anaconda there is the problem the every mesh will move (to simulate the slithering of the snake) continuosly. To solve this problem it has been used the trick of "backbone": usign a not visible mesh as root. See above picture, that yellow point, labeled as "Root mesh".
This trick has been already used in original moveables, for instance Von Croy has as root mesh (mesh 0) own a little and invisible mesh inside of its body.
About the body parts, I'm not yet sure about how many they will be, it depends by how large will be this anaconda.
About jaw mesh, it will be used to allow to bite and to give more mobility at our animal, like the forked tongue that is a must for a snake. We'll move in and out, it, of course.
Some suggstions about mesh-modelling with Metasequoia
Now I'll build all required mesh and then I'll show you the final outcome. Anyway, in the progress of this job, I'll give you also some little suggestion to get easier or smarter these operations.
Loading in the scene also a copy of Lara
When we build a moveable that (naturally) will interact with Lara, it's better have a good (visually) reference about its size, respect Lara.
I got above object from cleopal, it is Lara Double, and it is shaped by only 2 meshes (while the true lara has 15 meshes).
In this way, other to have a reference of sector size (using the suggested setting for Importing old mesh in MetaSequoia ), I'll have also an idea about how the new moveable will be respect Lara.
Meshes should be pasted and partially incorporated
Since, excepting Lara, moveables have not a "skin" to cover the junctions, it should be better moving every mesh in its parent for a little side.
Anyway also in this way, there could be a bad outcome (A picture).
To reduce that problem, we could give to the meshes a peaked shape at their extremities, like a cone (B picture).
In this way, if the relative rotations between parent and child is not higher than 45 degrees, the borders of junctions will be less sharped.
To be honest, the best shape should be that of a hemisphere, in this way the rotation could go over 45 degrees but it required a lot more of faces and vertices (below picture)
Anyway, once our Anaconda will be completed, you could remodelling its mehses in above way, if you wish.
How to duplicate meshes
It happens very often that a moveale had two or more identical meshes. In our case, with Anaconda, there will be many even meshes (all those labeled as "body part").
In Metasequoia, once you created a mesh, it's easy duplicate it to get a wished number of copies.
The steps to follow are:
- Select the original mesh, taking care that it was only one selected mesh in the scene.
- To select a mesh it's possible using the "Joined Face" mode in "Select" window (A Picture). When you work in this selecting mode, just click on one vertex of some mesh, to select the whole mesh and only that.
- Now we'll use the [Selected->Copy] menu command
- And then, we'll use the [Selected->Paste] menu command
- Now a new copy of previous mesh, will be placed in the scene. It will be the only selected and it will have been place in same position of original mesh, when you used the "Copy" command. For this reason you could have the feeling that nothing happened, because, that highlightes mesh, could look the old mesh you had copied but in the rality there are two even meshes overlapped (B Picture)
- To see the new mesh you could use the panel command [Move]. In this way you'll be able to move only the (new, duplicated) selected mesh and finally to detect it. (C picture)
Using only 90/180 degree rotations
Later we'll explain better The "always orthogonal" rule , about meshes of moveable in basic joint posture, now let's say that it's important avoiding to rotate meshes with angle different than +/-90 or 180 degrees.
To be sure to perform a perfect rotation of given degrees, it's better using the rotation tool whereby numbers (see above picture), where you type the number of degrees, choose the rotation axis (in above picture it was Y green axis) and then perform the rotation clicking on [ok] button.
The set of meshes for our Anaconda
At end of the story our Anaconda will have 14 meshes.
Note: in spite in above picture the meshes have a good distance between them, in the Basic Joint posture, they will be pasted inside other meshes, with their conic side fully embedded in closest mesh.
You can download the .mqo file with above set of meses from Level Manager website (anaconda_scene.rar)
About the assigned numbers (indices), they are not causal.
Now we should export to dxf file, each single mesh (so will have 14 dxf files) and then we'll import them in meshes of some slot.
It's important preserving the above sorting, because sub-meshes of a moveable have to be stored following some rules.
- Root mesh has always to be the first mesh in the slot. (Mesh with index = 0)
- All meshes linked in a parent-child chain, have to be stored in sequence: the child has always to follow its parent
- When a parent-child chain ends, it will be stored a mesh that was also parent of another (child) mesh
- When there are no more parent meshes and all parent-child meshes chain have been completed, it will be possibile adding randomly remaining child meshes and they will be all children of root mesh
Preparing the slot for our Anaconda
In spite we said to build a moveable "from scratch", we'll need anyway an iota of moveable slot where storing our meshes.
We'll be not interested about the nature of this "store" slot, but it will be important that it had the right number of meshes, same number of those of our new moveable.
An attemp, to find our ideal slot, is that to try to be lucky and looking for a moveable that had own 14 meshes. Another chance is to find a moveable with a bit more than 14 meshes and then delete some of them to get the right number. But, since this is a tutorial, and we have not yet explained how to add a mesh to some slot, well'use this method.
I found that the SETH_BLADE (slotid =172) has 13 meshes, so one less than that we wished: we'll use this slot. It is in settomb wad.
Adding a mesh to a moveable
Before working with wad merger, we have to add an empty mesh in the wad (settomb, in our case) and to do this, we need of StrPix program.
It's not necessary move on some mesh in StrPix, just only select the menu command [Edit/Add new empty mesh] and a mesh will be added at end of all meshes of the wad.
After this command, StrPix will show the new empty mesh and, since it is empty, we'll see only the black.
Now it's better importing (as .dxf file) a random mesh in this new mesh slot, to be able to see it in WadMerger.
It doesn't matter what mesh, let's say that we (keeping in mind the index of new empty mesh (in my case it is 375)) select another existing mesh, like the mesh 8 (Lara's angry head), we export it as .dxf, for instance "lara_angry.dxf", now we'll move newly to our empty mesh slot (for me it was 375) and now we import "lara_angry.dxf" in this slot.
Now we'll save the wad, quit StrPix and launch Wad Merger.
Load settomb wad, select "SETH BLADE" and launch Animation Editor.
I have to say that we run into a very weird object: it has 13 meshes but only three are visible!
Ok, I don't care, we'll replace all them, visible or less.
Now click on old [Mesh Tree Editor] button and select the Mesh 12.
Do you see that empty combo box at left of [Add] button? Well, click on it and select "Extra Mesh 0".
Now you'll see, in little 3d view, the Lara's head we had added.
Now we click on [Add] button and it will appear a "Mesh 13" at bottom of the meshes' list box.
Quit the mesh tree editor's window and let's see our new mesh in animation editor.
Uhm ok, the fact to have chosen own a head, get the final image rather disturbing!
Some notes:
- Also after the adding mesh, wad merger will have some problem with meshes' list box: we are not able to select the new 13th mesh. Anyway the solution for this bug is always the usual: just saving the wad and then realoding it, to have newly all working.
- If you are reading this tutorial, in spite you didnt' update your wad merger with trng_fixer 1.1.0.0 version, take care that, in previous version of wad merger (and trng_fixer), with some moveables there was a crash when you tried to add a new mesh. Anyway trng_fixer 1.1.0.0 fixed that bug.
Saving all single meshes
Now we got our moveable slot with right number of meshes. We don't care about position (transposition values) of current set of meshes, since we'll replace everything from scratch.
So, save the wad and quit wad merger. Now we have to come back to Metasquoia to save all meshes we built.
As first step, we have to free the side closed to origin of the scene (where you see the vertical of green Y axis) because we'll have to place a mesh closed to origin, before saving it.
Therefore, in the case there were other meshes in that side, we should select all meshes, usign the "Select/Rect" panel command (A Picture) and then move them (with "Move" panel command) far from origin (B Picture).
Unfortunately, for a bug in our Metasquoia version, saving only one mesh (ignoring the other of the scene) doesn't work. Theoractially we should set as "invisible" (with [Hide] Edit panel command" all other mehes, and then, in exporting dxf, select the "Visible objects only" option, to save only a single mesh, but it doesn't work: every meshes will be saved to dxf file and then reloded. So we'll have to use a trick to solve this problem...
Note: I suggest to save a .mgo copy of our scene (with all meshes) as backup, before performing this procedure.
To save every mesh in a single .dxf file, we'll have to perform following operations:
- We'll select the mesh to save (and only that)
- We'll move it closed to origin
- We'll align the scene's origin with our mesh, to set the exact pivot (center of rotation) for that mesh
- Now, we'll select all other meshes and hit the [Del] key (on keyboard) to cancel them.
- Now, choose the menu command: [File / Save as] and select "Autocad (.dxf)" files, choose a name (I suggest simply "mesh_N", where "N" will he the index of current mesh) and set the Export Dxf settings.
- Now choose "Edit/Undo" menu command, to recover all (previously deleted) meshes
- And then restart from 1) point, selecting another mesh, ect.
Setting the correct origin for each mesh
As explained in previous paragraph, it's important move the single mesh in correct position, respect the scene's origin,before saving it.
The origin will be the point where the mesh will be linked with its parent mesh and, in same way, the position of its center of rotation.
Only exception for this rule is about root mesh, since it has no parent mesh, it should be placed with the origin in its middle point.
For all other meshes we'll try to set the scene's origin where the mesh will be linked with its parent mesh.
For instance, all "body parts" and also "tail" and "neck" will have thir origin at the middle center of the cone's base, on side where there will be parent mesh.
In above image you can see the mesh (a moment earlier to save it) from three view angles.
You can get help from the [Abs] data of [Move] tool, to align the mesh with the origin in correct way.
Using parent mesh as reference for child mesh
For some very closed relation between parent and child, it could be advisable don't remove immediately the parent mesh already saved, when we are going to save also its child.
For instance in above picture, I had already saved the head mesh, but, before removing it from the scene, I let it in its origin position and I moved the next mesh to save, its child (the lower jaw), to use the reference of parent mesh (the head) for its child mesh (the jaw) (A and B pictures).
Once I placed the child in correct position, I selected the parent mesh (C picture) and then I removed it (D picture), so to be able to save only the jaw mesh.
I'll use same method for the tongue, that is the child of the jaw.
For some parent-child pair (it doesn't work always) that are overlapped, after having alinged the meshes in this way, the transpositon values will be {0,0,0} because they have already same origin.
Keeping always child's origin toward its parent mesh
Please note that, in spite there are some meshes that look the same (different body parts) they have to be saved with a different origin, in according with the direction where it should be their parent mesh.
For instance, in above picture we have two body part meshes: the mesh 1 (A Picture) and the mesh 7 (B Picture). They have same shape and size but it should be necessary saving them with a differen origin, because, while the mesh 1 has (in above view) the parent over, the mesh 7 will have it below (see also C picture as reference for their relation with the parent.
Importing all meshes in the wad
Once we have the full set of meshes, we have to import them in our wad file, startinf from first slot mesh of our slot.
We'll use again same method to discover what is first StrPix index where start our SETH_BLADE slot.
Just going to NG Level Editor, loading the wad (settomb in our case), select the object list and the verify what is the value for RMI column, for SETH_BLADE.
The mesh index is 200.
Note: if you want perform this exercise with me, you can download anaconda.rar file with the set of meshes for Anaconda e settomb wad file
We'll import the meshes following their index sorting.
In this pahse we'll skip the texturizing operations.
Now let's go to wadmerger, to see our meshes in Animation Editor.
Not so encouraging... but it doesn't matter.
Now we could have the temptation to modify the meshes, using their transposition values, to get our basic joints posture for anaconda, but we'll not work in this way.
We'll let that it was NG Tree Builder to do most of that job for us but, earlier, we'll have to collaborate with it, preparing some data.
Assigning names to Anaconda's meshes
A first job (useful for us, rather for the Analyser) is to assign meaningful names to the meshes.
Since a .nmf file is a text file, we could simply copy the index/name from our old reference:
to blacknotes and then save it as .nmf file.
This should be the text file:
SLOT:172
0:Root
1:Body Part 1
2:Neck 2
3:Neck 1
4:Head
5:Jaw (lower)
6:Tongue
7:Body Part 2
8:Body part 3
9:Body Part 4
10:Body Part 5
11:Tail 3
12:Tail 2
13:Tail 1
Note: 172 is the slot of SETH_BLADE, where we stored our anaconda. Therefore, if we'll save the "anaconda.nmf" file to default folder for nmf files (the "MeshNameFiles" subfolder of wadmerger) it will happen that, everytime we'll start NG Tree Builder with SETH_BLADE object, the names will be loaded.
Verify for duplicated meshes
Once we assigned valid names to the meshes of our Anaconda (see previous paragraph: Assigning names to Anaconda's meshes )
We have to verify that our meshe were all unique, i.e. without any duplicated mesh.
So, we'll click on "Compute Transposition values" button and, in the Transposition Analyser window , we'll check for duplicated mehses.
At start, let's say to uncheck the "Get meshes different, if it will be found a duplicated" option and then click on "Check for duplicated meshes" button
We'll get a report like this:
Found 10 duplicated pair of meshes
## FIRST_MESH ## SECOND MESH
---------------------------------------------------------------
1:Body Part 1 7:Body Part 2
1:Body Part 1 8:Body part 3
1:Body Part 1 9:Body Part 4
1:Body Part 1 10:Body Part 5
7:Body Part 2 8:Body part 3
7:Body Part 2 9:Body Part 4
7:Body Part 2 10:Body Part 5
8:Body part 3 9:Body Part 4
8:Body part 3 10:Body Part 5
9:Body Part 4 10:Body Part 5
---------------------------------------------------------------
There are 5 single meshes to modify
## DUPLICATED MESH
-------------------------------------------
1: Body Part 1
7: Body Part 2
8: Body part 3
9: Body Part 4
10: Body Part 5
-------------------------------------------
So, we discovered that there are five duplicated meshes...
I'm not surprised, of course, since I own duplicated same "body part" mesh five times. To build easily all meshes that was a good method, anyway now we have to change a bit those five meshes to have that every mesh was unique.
About the reason because it's necessary that all meshes were different see also: "Compute Transposition values" button paragraph.
Set all meshes as unique
Now we can repeat the [Check for duplicate meshes] operation but, this time, we'll check the "Modify mesh" option.
In this way the Analyser will change a bit every duplicated mesh.
At end we could see the report.
The first side is the same we had already seen (above), but this time, at end, there will be also some infos about the changes it did to get unique meshes:
Changes applied to meshes:
## MESH VX Old_Vertex New_Vertex
--------------------------------------------------------------------------------
1 Body Part 1 0 ( -1 , -61 , 2) ( -4 , -58 , -1)
7 Body Part 2 1 ( -50 , -42 , -266) ( -53 , -39 , -269)
8 Body part 3 2 ( -50 , -42 , -1) ( -53 , -39 , -4)
9 Body Part 4 3 ( -8 , -61 , -2) ( -11 , -58 , -5)
10 Body Part 5 4 ( 33 , -42 , 0) ( 30 , -39 , -3)
--------------------------------------------------------------------------------
-----------------------------------------------------------------------
Now we could verify that really all meshes are unique, clicking again on [Chek for duplicate meshes] button. There is, indeed, a very little chance that some mesh was still a duplicated, because analyser change really in light way the meshes.
Once we verified that all meshes are unique, we can save our wad file.
Building our Basic Joint Posture in Metasquoia
Now we should export all meshes from our wad and then to import them in Metasquoia.
This operation is necessary, of course, because we have to use last version of our meshes, that got unique by Transposition Analyser.
Once we have all exported .dxf files, we'll import all them in Metasequoia.
We'll use the "File->Insert" menu command. If you don't see the "Insert" command in menu "File", disable the "Basic Mode" in file menu.
Since, everytime we insert a mesh, it will be placed closed to the scene's origin, we'll have to move the previous inserted mesh, to let free space to the following.
The only exception of this rule, is when we are going to insert meshes that are really overlapped, like 4:Head, 5:Jaw and 6:tongue. (See below picture)
In this case it's better, letting that, only these three meshes was overlapped with their common origin. Then we'll select all three and we'll move away and, also later, we'll move them togheter to have them already well placed betwen them.
Since some mesh are very alike, it's better placing them in a reasonable sorting, also in this inserting (importing) phase:
Once we inserted all meshes (A Picture, below), we should select all them (with "Select All" command of "Edit" panel) (B picture) and then move them, until to overlap (about) the root mesh with scene's origin (C Picture)
Aligning all mehses in our final Basic Joint posture
And now the final job: magnify the view to be very closed to first mesh to align, the root mesh, and move it until it was perfectly in (0,0,0) position of scene's origin (A picture).
Then we'll move the closest meshes, pasting them in the way we have earlier explained (B and C Picture), until to do disappear the "conic" side of each mesh, flooding it, in the closed mesh.
Now we'll go with all other meshes, moving all them in their parent, and preserving the position of root mesh and others, already aligned, of course
Remember, when you are going to align head mesh, that that is a triple mesh, so you should select that group with "rect" selecting tool, to move all them togheter (see below picture)
The "always orthogonal" rule
When we'll place the meshes to build our basic joint posture, we could (theoretically) place them in many different ways and then, later, we'll have anyway the chance to move them using animations. This is true but it's better follow the rule to keep each mesh with a orthogonal relation with ohter meshes (and in particular those parent/child). It meansh that we should avoid to have meshes that follow diangonals with angles different thant 0, 90, 180, 270 degrees.
For instance, below set of mehses should be a terrible basic joint posture.
The problem is that, arms and legs are not orthogonal but follow a mixed diagonal.
Let's see instead the true lara's basic joint posture:
In A picture you can see Lara but all moveables follow this rule, also those have a really weird basic joint (wildboar), will have anyway all meshes placed orthogonal.
The reason is the compute of the distance between children and parent meshes will work better if there will be no diagonal (distance between two points) to calculate, since axis have a orthogonal placement, of course.
When two meshes (parent and child) are placed with only parallel or orthogonal angles, the compute of distance between their origins, will be very easy, it will be enough substract their coordinates by those of other mesh.
Our final Basic Joint Posture
Once completed and "compacted", our Anaconda doesn't look so large as we thought: 2 sectors, so about 4 meters!
Now, we'll export our basic joint posture as .dxf file and then we'll have to import it, in some static slot of our wad file.
Let's say to import in PLANT0 static of our settomb wad.
Using usual trick, we discover the strpix index of this slot, so it is the mesh with index 358.
Importing the basic joint posture with StrPix
Once imported the .dxf, in PLANT0 slot, we can watch our Anaconda in strpix, and, the wireframe view, it allows to like the internal structure of junctures and the root mesh.
Creating the parent-child pairs
Before using the "Translation Analyser" tool, to get the transposition values, we have to set the correct relation between parent and child meshes, since the Analyser will use those relations, to discover the relative distance between parent and child meshes in the basic joint posture.
So now, we have to perform following operations:
- Launch wadmerger and loading settomb wad file
- Start Animation Editor with our SETH_BLADE object
- Start NG Tree Builder
- In "Mesh Joints" frame, click the [Clear All] button, because the old mesh joints were those of the seth blade
- And now we have to insert all new "parent"-"child" pairs, following the hierarchy of our Anaconda
We'll start from root mesh, and then we'll follow the parent-child chain until it ends (See above picture)
Then we'll start newly from root mesh, but this time following the chain in the other direction
In the case we set some pair in wrong oreder, just clicking on [Sort] button, to sort in correct way the pairs. To verify it was correct, just looking at left column, that labeled "child" and all index numbers should be raising by 1.
Now we can save our project, clicking on [Save...] button in "Mesh Joints" frame.
Let's say to give the name: "anaconda" to our file.
It always better saving, to have a backup to reload in the case of some unfortunate accident.
Update the Anaconda's mesh tree
Now, we have to click on [Ok] button (in NG Mesh Tree window) to update really the mesh tree data in anaconda object.
Note: really this passage with [Ok] button, should be not really necessary, because Transposition Analyser has already in its memory the Mesh Joints pairs of NTB.
Anyway is safer passing through [ok] button procedure, because there will be some checks of validity of Mesh Joints, before saving them in mesh tree data, and, in this way, we could discover if the mesh joints are really correct. If we omitted this procedure (with [ok] button) and we made some mistakes, then, using Transposition Analyser tool, the compute of Transpositon values, could be wrong.
Therefore, if you quit NTB with ok button and get no error message, we'll know that mesh joints were right. Now we can start newly NG Tree Builder and click on [Compute Transpositions] button.
Warning for wrong number of vertices
It could happen that, once you clicked on [Compute Transposition] button, you received a warning:
Let's say that it's not always so worrying. It could happen that metasequoia removed some vertices (when you export the basic joint posture to a .dxf file) because they had excaclty same 3d position of other vertices.
Anyway, if the difference between vertices amout is very strong, it is possible that you mistaked something, perhaps writing wrong index number about the mesh of your Basic Joint Posture?
The warning of above image shows only six less vertices on 244, so in this case, probably, it's not a real issue. Click on [Yes] button to go on in the compute.
We got our final mesh tree
If the analyser completed the job with above message, it means that finally our new moveable got its new mesh tree. Now we can quit NTB (with ok button, to update the changes on transposition values) and let's see how our anaconda looks in animation editor.
Ok, it is not so cool (it is still untexturized) but at least now it has the shape we had projected.
Resetting old animation data
Above image was from basic joint posture, with "No animation" selected, but if we try to look our anaconda in some animation, it will look rather weirdo:
It happens because animation are those of old Seth Blade, of course.
Since old animation are not compatible with our Anaconda, it should be better removing them.
Therefore, we'll use the "Clear all animations (except one)" button that we can find in Transposition Analyser window.
Click on [Remove Animations] button, confirm your choice and now let's come back to animation editor in our only one survived "flat" animation.
We could try to animate our new object, giving it a more sneaky posture:
Ok but we'll have own to texturize it!
Fixing some meshes
Since now we have our mesh tree, there is no more need to fear to change the meshes, or to have some duplicated meshes.
Therefore I fixed the body part meshes, because Transposition Analyser, to get them different, had also damaged a bit them.
Since I was working with Metasequoia, I thought to change also a bit the head (and the jaw). In spite Anaconda is not famous for its teeth (it doesn't chew, swallow whole animals) anyway I added some little meshes in the mouth, to can then adding teeth as transparent textures on those little 2d faces (see below picture)
Adding textures to Anaconda
It's not a masterpiece, I know: skin like wallpaper and doll's eyes, but it's not important, we could improve them in the future.
Now there is yet a mesh-tree specific issue to solve and, with an untexturized object,
it should have been complicated also only to explain.
How to modify the pivot of rotation
Let's look a detail about the tongue of our snake...
The tongue is a distinct mesh and not a side of jaw or head. This means that we could rotate it.
The idea was to give the look of a snake that moves in and out its forked tongue but, when we try to perform this rotation, something goes bad.
We turn the mesh around the X axis, of course but the tongue, instead to come out from the mouth, it move down across the jaw (B e C picture)
Ok, let's say that there has been a mistake in projecting phase, anwyay now we'll try to fix this problem, modifying the pivot of rotation.
If the pivot was lower and more far from jaw, probably the rotation could work better.
See below A picture.
In blue you see the current pivot and the movement around it. If we had the pivot in red position we should have a larger rotation that could move the tongue in better way.
So now we try to move down the Y position of pivot to reach that red point. Let's say that distance was abouit half sector: 512 units.
Since the Y axis has positive number to move down and negative numbers to move up, we'll add +512 to transposition Y of tongue mesh.
Then, click on [Update] button and quit NTB window with [Ok] button, to validate new values.
Let's see what happened in Animation Editor:
The tongue moved down but we wished having only the pivot of rotation in that position (A picture) and not the tongue mesh. To fix this problem now we have to move up the mesh (but only the mesh and not its pivot) . Since we had moved down of 512 units (adding +512 to TranY of tongue mesh) now well move the mesh up, adding -512 (to move up) to mesh vertices (B Picture), letting unchanged the pivot.
To move only the vertices of a mesh, we have to use [Edit Mesh] tools and in particular the Move Mesh command:
Now, click on [Move Mesh] button and then let's come back to animation editor to see the outcome.
The tongue came back to its original position! It could look like nothing has been changed but in the reality something changed: the pivot of rotation. Now it is very lower than tongue.
Now let's try again to rotate the tongue:
Now it works fine. Please note where is now the pivot of rotation and how (B and C picture) the tongue performs own the movement we wished.
Trick: How to move a sub-mesh of a moveable
Now let's see a trick to get a target that is apparenlty impossible: to move a sub-mesh of a moveable.
Probably many of you already know this trick but, since it is in topic with this tutorial, and it could be usefull in many circustances, I want explaining well how it works.
Who used Animation Editor for many year, knows very well that we can only turn (rotate) sub-meshes but not to move them. Only one mesh that we could move, is mesh 0 (the root) but this movement will affect whole object and it's not that we wish.
Now we'll explain this trick, creating another new moveable: an armored sliding door.
Ok, I know, someone could think to have already seen in tomb raider sliding doors but if you analyse better those objects, you'll discover that this "skill" was based very often on one of these two methods:
- Using two moveables working togheter (and so one of these were entirely moved. Usual situation with movement of mesh 0)
- This sliding door was really sahped by only one mesh and only that (i.e. the entire moveable) was moved
An then, ok, other times, it was based own on the trick that we are going to explain...
Our target is having a moveable (and only one) shaped by two or more meshes, where one on these will be moved in vertical or horizontal way.
Our Armored sliding Door
Since we have already explained how to build a moveable from scratch, I'll skip this phase.
This it will be our armored door
You can see also the three meshes of the door:
(from its .nmf file)
SLOT:134
0:Framework
1:Bars (left)
2:Bars (right)
Note: the "left" and "right" attribute, in this case, work own how you see them in above picture: the left bars are those at left in this picture.
Our target: to move two sliding Bars' sets
We want that, in the opening animation, the left bars moved at left, and the right bars moved at right, letting free the passage.
We can only rotate mesh 1 and 2, but we'll use our trick that is the same already showed for the Anaconda's tongue but this time in more extreme way.
We'll change the pivot of rotation for each bar set, and we'll use a really very big number.
About how big could be this number it's necessary to consider that:
- Adding value bigger than 32,560 could take an overflow of transposition values (and also about vertices of meshes). An overflow, in this case, will get a useless final number that could look very little in spite it should be very big. It's a situation to avoid
About this limit, let's say that upto 30,000 we could be safe but it depends also by the previous value of our field. If the transposition value or vertex's coordinate was already over 2,000, there will be the risk of overflow.
- Also avoding the risk of overflow, using exagerated number could create another collateral effect: when the pivot is too far from its mesh, the littlest rotation (few degress) could affect a huge (apparent) movement. This could be a problem if we wished to have a smooth (or slow) movement of this mesh.
Considering above issues, I chose as number 8000 (only an attempt)
Choosing the axis where to move pivot
Really, we'll have always two axis for this choice, all axis are good, excluding that one where we want move our mesh. So, in this case, since we want move the bars on X axis, we cannot chosing that, but we can choose Y or Z axis. Let's say that, this time, we'll use the Z axis (while with tongue, we used Y axis)
We have already seen how this trick work (see How to modify the pivot of rotation chapter)
We have to add a value to the transposition value, on some axis, and then we'll move the mesh, on the same axis and with the previous value but with inverted sign.
So now we add +8000 to Z Transpositon of 1:Bar (left) and then we'll move 1:Bar (left) mehs of -8000 on Z axis.
And now, let's try to "rotate" the mesh1:
It works enough fine but, look with a top-view, we could notice that there's been a rotation (see below picture)
Some words to say...
Porbably, in game it should work fine, because Lara (or the player) we'll be not able to see from a top-view the door and the bars, after the movement /rotation, will vanish iin the wall.
Anyway, now that we have to move also the right bars, we could try with another value, yet bigger: for instance 16,000
In this case we'll work on 2:Bars (right) mesh and we'll use 16,000 as pivot riposition.
Let's see how it works this time:
From a frontal view, right and left bars look the same (A picture), but, from a top-view (B Picture), we see that right bars are a bit better.
Anyway the rotate/movement was really very fast, not so easy (manually) moving it slowly. For the whole (movement/rotation) i.e.the bars that left free the passage, the change in rotation has been only by 2 degrees. I had only three intemediat position for the bars. I think it was a bit too fast.
At end, I suppose that perhaps the best could be a compromise, let's say 10,000
Now I'll change both distance for pivot to have 10,000 for both meshes, and then we'll try to use Animation Wizard to have our opening animation.
Animation of our sliding door
Setting, in Animation Wizard mode, first and last frame to get the opening of the door (above picture) I got an animation. I set 30 frames as length to verify if it was possible having a smooth movement and, as I feared, there has been a problem: in the final animation, the bars kept still for groups of three frames and then the bars moved suddenly.
This problem ocurred own because also a very little rotation affect a big movement of the mesh (the bars).
Probably also 10,000 is a too big number.
Trying in game the sliding door
Once copied the sliding door from the SLICER_DICER 134 slot, to a DOOR_TYPE1 slot, to do work it, I tried it in game. (See above picture)
It works enough fine but the movemement was not so smooth.
Conclusions
We saw how now it's possible modify easily old moveables and also how to create from scratch a new moveable.
In this tutorial we have not faced the following phase: to make new animations for our (new) moveable and how to do work it in tomb4.
About animation stuff, there are plenty of level builders that are able to make custom animations. While, about the code for tomb4, I hope that, with trng plugins and many source samples, it will be possible also finding some programmer that made required code to hande new moveables.
I have not the time to build also all code and animations required to do work all examples of this tutorial, anyway I'll try to write at least one source code that was easily customizable to do work many new moveables, with only little mods.